#include "settingswidget.h"
#include "ui_settingswidget.h"
#include <QListWidgetItem>
#include <QDebug>
SettingsWidget::SettingsWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::SettingsWidget)
{
    ui->setupUi(this);
    ui->listWidget->setCurrentRow(0);
    SettingsPageManger::switchToPage(ui->widget,SettingsPageManger::ACCOUNTPAGE);
}

SettingsWidget::~SettingsWidget()
{
    delete ui;
}



void SettingsWidget::on_listWidget_currentRowChanged(int currentRow)
{

    switch (currentRow) {
    case 0:
        SettingsPageManger::switchToPage(ui->widget,SettingsPageManger::ACCOUNTPAGE);
        break;
    case 1:
        SettingsPageManger::switchToPage(ui->widget,SettingsPageManger::MESSAGEPAGE);
        break;
    case 2:
        SettingsPageManger::switchToPage(ui->widget,SettingsPageManger::CURRENCYPAGE);
        break;
    case 3:
        SettingsPageManger::switchToPage(ui->widget,SettingsPageManger::FILEPAGE);
        break;
    case 4:
        SettingsPageManger::switchToPage(ui->widget,SettingsPageManger::ABOUTPAGE);
        break;
    }
}

void SettingsWidget::closeEvent(QCloseEvent *event)
{
    SettingsPageManger::deletePage();
}
